import router from '../router'
import axios from './axios'

axios.interceptors.request.use(function(res) {
  let user_token = ''
  if(window.localStorage.hasOwnProperty('user_token')){
    user_token = window.localStorage.getItem('user_token')
  }
  res.headers.common['Admin-token'] = user_token
  return res
})

axios.interceptors.response.use(function(response) {
  // 重定向到登录页面
  if (response && response.data.hasOwnProperty("data") && response.data.data == 'no_login') {
    router.replace({ path: '/login' })
    return response
  } else {
    return response
  }
   return response
})

//后台管理
export const  signInUser = (params) => axios.post('admin/signInUser',params)
//退出登录
export const  loginOut = () => axios.get('admin/loginOut')
//修改密码
 export const  changePassword = (params) => axios.post('admin/auth/changePassword',params)
//获取管理员信息
 export const  getAdminUserInfo = (params) => axios.get('admin/getAdminUserInfo',{'params':{...params}})


//设置轮播图
export const  setBanner = (params) => axios.post('admin/setBanner',params)
//删除轮播图
export const  delBanner = (params) => axios.post('admin/delBanner',params)
//banner详情
export const  getBannerDetail = (params) => axios.get('admin/getBannerDetail',{"params":{...params}})
//banner列表
export const  getBannerList = (params) => axios.get('admin/getBannerList',{"params":{...params}})
//设置关于我们
export const  setAboutUs = (params) => axios.post('admin/setAboutUs',params)
//获取关于我们
export const  getAboutUs = (params) => axios.get('admin/getAboutUs',params)


//功能区列表
export const  getButtonList = (params) => axios.get('admin/getButtonList',{"params":{...params}})
//功能去详情
export const  getButtonDetail = (params) => axios.get('admin/getButtonDetail',{"params":{...params}})
//设置功能区
export const  setButton = (params) => axios.post('admin/setButton',params)
//删除功能区
export const  delButton = (params) => axios.post('admin/delButton',params)

//获取用户列表
export const  getUserList = (params) => axios.get('admin/getUserList',{"params":{...params}})
//获取消费用户列表
export const  getConsumeUserList = (params) => axios.get('admin/getConsumeUserList',{"params":{...params}})

//设置课程类型
export const  setCourseType = (params) => axios.post('admin/course/setCourseType',params)
//获取课程类型（分类）列表
export const  getCourseTypeList = (params) => axios.get('admin/course/getCourseTypeList',{"params":{...params}})
//删除课程类型（分类）
export const  delCourseType = (params) => axios.post('admin/course/delCourseType',params)

//设置老师
export const  setTeacher = (params) => axios.post('admin/course/setTeacher',params)
//获取课程类型（分类）列表
export const  getTeacherList = (params) => axios.get('admin/course/getTeacherList',{"params":{...params}})
//删除老师
export const  delTeacher = (params) => axios.post('admin/course/delTeacher',params)

//设置套餐
export const  setPackages = (params) => axios.post('admin/course/setPackages',params)
//获取套餐列表
export const  getPackagesList = (params) => axios.get('admin/course/getPackagesList',{"params":{...params}})
//获取套餐详情
export const  getPackagesDetail = (params) => axios.get('admin/course/getPackagesDetail',{"params":{...params}})
//删除套餐
export const  delPackages = (params) => axios.post('admin/delPackages',params)

//设置课程类型
export const  setCourse = (params) => axios.post('admin/course/setCourse',params)
//获取课程列表
export const  getCourseList = (params) => axios.get('admin/course/getCourseList',{"params":{...params}})
//获取课程详情
export const  getCourseDetail = (params) => axios.get('admin/course/getCourseDetail',{"params":{...params}})

//获取视频显示状态
export const  getVideoStatus = (params) => axios.get('admin/getVideoStatus',{"params":{...params}})
//设置视频状态
export const  setVideoStatus = (params) => axios.post('admin/setVideoStatus',params)

//优惠券列表
export const  getCouponList = (params) => axios.get('admin/getCouponList',{"params":{...params}})
//获取优惠券详情
export const getCouponDetail = (params) => axios.post('admin/getCouponDetail',params)
//设置优惠券
export const setCoupon = (params) => axios.post('admin/setCoupon',params)
//删除促销规则
export const delCoupon = (params) => axios.post('admin/delCoupon',params)

//人员列表
export const  getStaffList = (params) => axios.get('admin/getStaffList',{"params":{...params}})
//编辑人员
export const setStaff = (params) => axios.post('admin/setStaff',params)
//删除人员
export const delStaff = (params) => axios.post('admin/delStaff',params)
//邀请购买列表
export const  inviteBuyList = (params) => axios.get('admin/inviteBuyList',{"params":{...params}})
//邀请注册列表
export const  inviteRegisterList = (params) => axios.get('admin/inviteRegisterList',{"params":{...params}})

//设置拼团活动
export const  getSystemGroupList = (params) => axios.get('admin/course/getSystemGroupList',{"params":{...params}})
//获取拼团活动详情
export const  getSystemGroupDetail = (params) => axios.get('admin/course/getSystemGroupDetail',{"params":{...params}})
//设置拼团活动
export const setSystemGroup = (params) => axios.post('admin/course/setSystemGroup',params)
//删除拼团活动
export const delSystemGroup = (params) => axios.post('admin/course/delSystemGroup',params)

//获取订单信息
export const  getOrderList = (params) => axios.get('admin/course/getOrderList',{"params":{...params}})

//获取管理员列表
export const adminList = (params) => axios.get('admin/adminList',{"params":{...params}})

//添加管理员用户
export const setAdmin = (params) => axios.post('admin/setAdmin',params)
//管理员信息
export const  adminSet = (params) => axios.get('admin/adminSet',{"params":{...params}})

//改变管理员状态
export const changeAdminStatus = (params) => axios.post('admin/changeAdminStatus',params)

//删除管理员用户
export const delAdmin = (params) => axios.post('admin/delAdmin',params)

//添加管理员用户
export const  getAuthorizerList = (params) => axios.get('admin/getAuthorizerList',{"params":{...params}})

//删除角色
export const delRole = (params) => axios.post('admin/delRole',params)
//获取角色列表
export const  roleList = (params) => axios.get('admin/roleList',{"params":{...params}})
//添加角色
export const setRole = (params) => axios.post('admin/setRole',params)
//角色信息
export const  roleSet = (params) => axios.get('admin/roleSet',{"params":{...params}})
//获取权限列表
export const  permissionsList = (params) => axios.get('admin/permissionsList',{"params":{...params}})

//获取签到记录
export const  getCourseSignRecord = (params) => axios.get('admin/course/getCourseSignRecord',{"params":{...params}})
//签到
export const  courseSign = (params) => axios.get('admin/course/courseSign',{"params":{...params}})
//获取报名表
export const  getCourseJoinInList = (params) => axios.get('admin/course/getCourseJoinInList',{"params":{...params}})

//设置客户资料（线索)
export const setCustomerClue = (params) => axios.post('admin/crm/setCustomerClue',params)
//删除客户资料（线索）
export const delCustomerClue = (params) => axios.post('admin/crm/delCustomerClue',params)
//获取客资料（线索)
export const  getCustomerClueList = (params) => axios.get('admin/crm/getCustomerClueList',{"params":{...params}})
//获取客户服务历史
export const  getCustomerServiceRecord = (params) => axios.get('admin/crm/getCustomerServiceRecord',{"params":{...params}})
//分配客户线索跟进人员
export const setCustomerServiceStaff = (params) => axios.post('admin/crm/setCustomerServiceStaff',params)


//设置会员
export const setUserVip = (params) => axios.post('admin/vip/setUserVip',params)
//获取用户会员信息
export const  getUserVipList = (params) => axios.get('admin/vip/getUserVipList',{"params":{...params}})
//获取用户会员信息
export const  getUserBuyCourseList = (params) => axios.get('admin/getUserBuyCourseList',{"params":{...params}})
//获取用户的积分记录
export const  getIntegralRecordList = (params) => axios.get('admin/getIntegralRecordList',{"params":{...params}})
//获取会员列表
export const  getVipUserList = (params) => axios.get('admin/getVipUserList',{"params":{...params}})

